package com.mvc.login.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.mvc.annotation.ActionMapping;
import com.mvc.common.MvcActionController;
import com.mvc.common.service.CommonServiceImpl;
import com.mvc.common.service.CommonServiceProxy;
import com.mvc.common.service.ILoginService;
import com.mvc.model.ActionView;

public class LoginActionController extends MvcActionController {

	@ActionMapping("/login/login.go")
	public ActionView login(HttpServletRequest request, HttpServletResponse response) {
		String name = request.getParameter("loginname");
		
		ILoginService loginService = (ILoginService)CommonServiceProxy.getCommonServiceFactory(CommonServiceImpl.class);
		String str = loginService.login(name);
		
		ActionView actionView = new ActionView("success.form");
		actionView.addObject("name", name + " from login success! " + str);
		return actionView;
	}
}
